{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "rklMFAsZnk_9"
      },
      "source": [
        "# Exercise Set 1\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "xxzIRHkEw3Um"
      },
      "source": [
        "## Multiple choice\n",
        "**Q1.** All projects that can utilize mathematical optimization identify this well in advance.\n",
        "> TRUE\n",
        "\n",
        "> FALSE\n",
        "\n",
        "**Q2.** The core value of machine learning lies in the _________ used to fit models. In mathematical optimization, the _________ carries most of the value.\n",
        ">a. platform, GPU\n",
        "\n",
        ">b. data, algorithms\n",
        "\n",
        ">c. algorithms, industry\n",
        "\n",
        ">d. parallelization, data\n",
        "\n",
        "**Q3.** Heuristics often have a way to know how far a current solution may be from the optimal solution.\n",
        "> TRUE\n",
        "\n",
        "> FALSE\n",
        "\n",
        "**Q4.** While it is good to note the size of a mathematical optimization problem in terms of the number of variables and constraints, it is far from a reliable way to measure how long it will take to solve.\n",
        "> TRUE\n",
        "\n",
        ">FALSE"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "4g1g9c6LpDCd"
      },
      "source": [
        "## Free Responses\n",
        "````\n",
        "I suggest getting some paper and pencil here for some of these\n",
        "````\n",
        "**Q5.** Apply `DeMorgan's laws` to the following statements. Final answers should only use the $=$, $\\le$, $\\ge$, $<$, and $>$ comparison symbols, where applicable.\n",
        ">a. Not (Python or R).\n",
        "\n",
        ">b. It's not the case that both $x$ is equal to 0 and $y$ is positive.\n",
        "\n",
        "**Q6.** Let $a$ be the amount of snow that falls overnight and $b$ is a binary variable indicating if school is open ($b=1$) or closed ($b=0$). Use this, and the `IF-THEN` to an `OR` statement equivalence to rewrite this statement: \"If it snows more than 8 inches overnight, then school will be closed tomorrow.\"\n",
        "\n",
        "**Q7.** Write the `contrapositive` of \"If Duke is late for a meeting, that's because he was out surfing.\"\n",
        "\n",
        "**Q8.** In the **Using Big M Constraints** section of last session's notebook, we used the following inequality $x + M_2 \\times z \\ge C$.\n",
        ">a. Simplify this inequality replacing $𝑀_2$ with $C$.\n",
        "\n",
        ">b. The other clause of this `OR` statement was $x \\le M_1\\times(1-z)$. Write out what these two inequalities reduce to when $z = 1$ and $z = 0$."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "0HiQb2A8RUHy"
      },
      "source": [
        "## Formulation and Coding\n",
        "**Q9.** In the **Constrainting production facilities** section of the Modeling Example 1 notebook, when adding the $y$ decision variables for opening production facilities, assume there are fixed costs, given by the list `[180, 150, 120, 155, 175]` for activating each respective distribution center. Write `gurobipy` code that will add these costs to the original objective function.\n",
        "\n",
        "**Q10.** Write `gurobipy` code using indicator constraints to model the following. Both parts reference the decision variables in the Modeling Example 1 notebook.\n",
        ">a. The link between $x_{p,d}$ and $y_p$.\n",
        "\n",
        ">b. If Cleveland and Baltimore are open, then Charleston must be closed. Feel free to add *auxiliary variables* if you want. \n",
        "\n",
        "**Homework (optional):** Formulate the **Regional restriction** constraint as a big M constraint (this one may be a bit difficult for non-experts).\n",
        "\n",
        "\"If the production facility in *Charleston* is open then *Cleveland* and *Baltimore* cannot be open.\""
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "TM8a0FOfyInf"
      },
      "outputs": [],
      "source": []
    }
  ],
  "metadata": {
    "colab": {
      "provenance": [],
      "toc_visible": true
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}
